﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace DHJ.Cost.Migrations
{
    public partial class Added_EstimatedCostMessage : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "EstimatedCostMessages",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CostId = table.Column<Guid>(nullable: false),
                    UserId = table.Column<long>(nullable: false),
                    Readed = table.Column<bool>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EstimatedCostMessages", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EstimatedCostMessages_EstimatedCosts_CostId",
                        column: x => x.CostId,
                        principalTable: "EstimatedCosts",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_EstimatedCostMessages_CostId",
                table: "EstimatedCostMessages",
                column: "CostId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "EstimatedCostMessages");
        }
    }
}
